/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MovementViewFrame.java
 *
 * Created on Jun 27, 2011, 12:38:19 PM
 */

package gbbmgmt;

import java.util.*;
import org.jdesktop.application.Action;
import javax.swing.JOptionPane;
import java.text.*;

/**
 *
 * @author dchapman
 */
public class MovementViewFrame extends javax.swing.JFrame {

    public ArrayList<String[]> Movement;

    //Create Number Formater for displaying numbers.
    public NumberFormat f2 = new DecimalFormat("#0.00");
    public NumberFormat f0 = new DecimalFormat("#0");
    public NumberFormat f3 = new DecimalFormat("#0.000");

    /** Creates new form MovementViewFrame */
    public MovementViewFrame() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jComboBoxMovement = new javax.swing.JComboBox();
        jButtonFirst = new javax.swing.JButton();
        jButtonPrev = new javax.swing.JButton();
        jButtonNext = new javax.swing.JButton();
        jButtonLast = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jLabel1 = new javax.swing.JLabel();
        jLabeMovementID = new javax.swing.JLabel();
        jLabelMovementDate = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabelMovementBrewID = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabelMovementOldState = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabelMovementStateID = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabelMovementVolume = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabelMovementEmpID = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabelMovementNotes = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabelMovementOVID = new javax.swing.JLabel();
        jLabelMovementNVID = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jCheckBoxSameBrew = new javax.swing.JCheckBox();
        jTextFieldBrewID = new javax.swing.JTextField();
        jButtonExit = new javax.swing.JButton();
        jButtonRefresh = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setName("Form"); // NOI18N

        jComboBoxMovement.setName("jComboBoxMovement"); // NOI18N
        jComboBoxMovement.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                jComboBoxMovementPopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
        });

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(gbbmgmt.GBBMGMTApp.class).getContext().getActionMap(MovementViewFrame.class, this);
        jButtonFirst.setAction(actionMap.get("FirstRecord")); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(gbbmgmt.GBBMGMTApp.class).getContext().getResourceMap(MovementViewFrame.class);
        jButtonFirst.setText(resourceMap.getString("jButtonFirst.text")); // NOI18N
        jButtonFirst.setName("jButtonFirst"); // NOI18N

        jButtonPrev.setAction(actionMap.get("PrevRecord")); // NOI18N
        jButtonPrev.setText(resourceMap.getString("jButtonPrev.text")); // NOI18N
        jButtonPrev.setName("jButtonPrev"); // NOI18N

        jButtonNext.setAction(actionMap.get("NextRecord")); // NOI18N
        jButtonNext.setText(resourceMap.getString("jButtonNext.text")); // NOI18N
        jButtonNext.setName("jButtonNext"); // NOI18N

        jButtonLast.setAction(actionMap.get("LastRecord")); // NOI18N
        jButtonLast.setText(resourceMap.getString("jButtonLast.text")); // NOI18N
        jButtonLast.setName("jButtonLast"); // NOI18N

        jSeparator1.setName("jSeparator1"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabeMovementID.setText(resourceMap.getString("jLabeMovementID.text")); // NOI18N
        jLabeMovementID.setName("jLabeMovementID"); // NOI18N

        jLabelMovementDate.setText(resourceMap.getString("jLabelMovementDate.text")); // NOI18N
        jLabelMovementDate.setName("jLabelMovementDate"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jLabelMovementBrewID.setText(resourceMap.getString("jLabelMovementBrewID.text")); // NOI18N
        jLabelMovementBrewID.setName("jLabelMovementBrewID"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabelMovementOldState.setText(resourceMap.getString("jLabelMovementOldState.text")); // NOI18N
        jLabelMovementOldState.setName("jLabelMovementOldState"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabelMovementStateID.setText(resourceMap.getString("jLabelMovementStateID.text")); // NOI18N
        jLabelMovementStateID.setName("jLabelMovementStateID"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jLabelMovementVolume.setText(resourceMap.getString("jLabelMovementVolume.text")); // NOI18N
        jLabelMovementVolume.setName("jLabelMovementVolume"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jLabelMovementEmpID.setText(resourceMap.getString("jLabelMovementEmpID.text")); // NOI18N
        jLabelMovementEmpID.setName("jLabelMovementEmpID"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jLabelMovementNotes.setText(resourceMap.getString("jLabelMovementNotes.text")); // NOI18N
        jLabelMovementNotes.setName("jLabelMovementNotes"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jLabelMovementOVID.setText(resourceMap.getString("jLabelMovementOVID.text")); // NOI18N
        jLabelMovementOVID.setName("jLabelMovementOVID"); // NOI18N

        jLabelMovementNVID.setText(resourceMap.getString("jLabelMovementNVID.text")); // NOI18N
        jLabelMovementNVID.setName("jLabelMovementNVID"); // NOI18N

        jSeparator2.setName("jSeparator2"); // NOI18N

        jCheckBoxSameBrew.setText(resourceMap.getString("jCheckBoxSameBrew.text")); // NOI18N
        jCheckBoxSameBrew.setName("jCheckBoxSameBrew"); // NOI18N

        jTextFieldBrewID.setText(resourceMap.getString("jTextFieldBrewID.text")); // NOI18N
        jTextFieldBrewID.setName("jTextFieldBrewID"); // NOI18N

        jButtonExit.setAction(actionMap.get("ExitMovement")); // NOI18N
        jButtonExit.setText(resourceMap.getString("jButtonExit.text")); // NOI18N
        jButtonExit.setName("jButtonExit"); // NOI18N

        jButtonRefresh.setAction(actionMap.get("RefreshSet")); // NOI18N
        jButtonRefresh.setText(resourceMap.getString("jButtonRefresh.text")); // NOI18N
        jButtonRefresh.setName("jButtonRefresh"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jComboBoxMovement, 0, 223, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonFirst)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonPrev)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonNext)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonLast)
                .addContainerGap())
            .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabeMovementID)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 181, Short.MAX_VALUE)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelMovementDate)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelMovementBrewID)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 167, Short.MAX_VALUE)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelMovementVolume)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel6)
                .addContainerGap())
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelMovementOldState)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelMovementStateID)
                .addContainerGap(186, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelMovementEmpID)
                .addContainerGap(305, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel10)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelMovementOVID)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 5, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelMovementNVID))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelMovementNotes)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(331, Short.MAX_VALUE))
            .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 447, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jCheckBoxSameBrew)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextFieldBrewID, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButtonRefresh)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 25, Short.MAX_VALUE)
                .addComponent(jButtonExit)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jButtonPrev)
                    .addComponent(jButtonFirst)
                    .addComponent(jButtonNext)
                    .addComponent(jButtonLast)
                    .addComponent(jComboBoxMovement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(jLabeMovementID)
                    .addComponent(jLabelMovementDate)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabelMovementBrewID)
                    .addComponent(jLabel6)
                    .addComponent(jLabelMovementVolume)
                    .addComponent(jLabel7))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabelMovementOldState)
                    .addComponent(jLabel5)
                    .addComponent(jLabelMovementStateID))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jLabelMovementEmpID))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(jLabelMovementOVID))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11)
                    .addComponent(jLabelMovementNVID))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(jLabelMovementNotes))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jCheckBoxSameBrew)
                    .addComponent(jTextFieldBrewID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonExit)
                    .addComponent(jButtonRefresh))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBoxMovementPopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBoxMovementPopupMenuWillBecomeInvisible
        // TODO add your handling code here:
        String Itm = jComboBoxMovement.getSelectedItem().toString();

        for(String s[] : Movement){
            String mvmtitm = s[0] + " - " + s[2] + " - " + s[1];
            if (mvmtitm.equals(Itm)) {
                DBA.openDBCon();
                DBA.GetMovementData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
}//GEN-LAST:event_jComboBoxMovementPopupMenuWillBecomeInvisible

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MovementViewFrame().setVisible(true);
            }
        });
    }

    public void LoadList(){
        DBA.openDBCon();
        Movement = DBA.RunSQLQuery("SELECT MovementID,MovementBrewID,MovementDate FROM Movement");
        DBA.closeDBCon();

        for(String s[] : Movement){
            String mvmtitm = s[0] + " - " + s[2] + " - " + s[1];
            jComboBoxMovement.addItem(mvmtitm);
        }

        LastRecord();
    }

    public void SetData(){
        DBA.openDBCon();

        //Label id
        jLabeMovementID.setText(Integer.toString(DBA.MovementID));

        //Get Brew Data.
        DBA.GetBrewsData(Integer.toString(DBA.MovementBrewID));
        DBA.GetBeerData(Integer.toString(DBA.BBeerID));
        jLabelMovementBrewID.setText(Integer.toString(DBA.MovementBrewID)+ " - " + DBA.BName);

        //Set Date.
        jLabelMovementDate.setText(DBA.MovementDate.toString());

        //Set State info.
        DBA.GetStateData(Integer.toString(DBA.MovementOldState));
        jLabelMovementOldState.setText(DBA.StateDesc);
        DBA.GetStateData(Integer.toString(DBA.MovementStateID));
        jLabelMovementStateID.setText(DBA.StateDesc);

        //Set Volume.
        jLabelMovementVolume.setText(f2.format(DBA.MovementVolume));

        //Set Employee.
        DBA.GetEmployeeData(Integer.toString(DBA.MovementEmpID));
        jLabelMovementEmpID.setText(DBA.EmpLastName + ", " + DBA.EmpFirstName);

        //Set Vessel Data.
        DBA.GetFVData(Integer.toString(DBA.MovementOVID));
        jLabelMovementOVID.setText(DBA.FVDesg);
        DBA.GetFVData(Integer.toString(DBA.MovementNVID));
        jLabelMovementNVID.setText(DBA.FVDesg);

        //Set Notes.
        jLabelMovementNotes.setText(DBA.MovementNotes);

        DBA.closeDBCon();
    }

    @Action
    public void LastRecord() {
        jComboBoxMovement.setSelectedIndex(jComboBoxMovement.getItemCount()-1);

        String Itm = jComboBoxMovement.getSelectedItem().toString();

        for(String s[] : Movement){
            String mvmtitm = s[0] + " - " + s[2] + " - " + s[1];
            if (mvmtitm.equals(Itm)) {
                DBA.openDBCon();
                DBA.GetMovementData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }

    @Action
    public void FirstRecord() {
        jComboBoxMovement.setSelectedIndex(0);

        String Itm = jComboBoxMovement.getSelectedItem().toString();

        for(String s[] : Movement){
            String mvmtitm = s[0] + " - " + s[2] + " - " + s[1];
            if (mvmtitm.equals(Itm)) {
                DBA.openDBCon();
                DBA.GetMovementData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }

    @Action
    public void PrevRecord() {
        if(jComboBoxMovement.getSelectedIndex()>=1){
            jComboBoxMovement.setSelectedIndex(jComboBoxMovement.getSelectedIndex()-1);
        }

        String Itm = jComboBoxMovement.getSelectedItem().toString();

        for(String s[] : Movement){
            String mvmtitm = s[0] + " - " + s[2] + " - " + s[1];
            if (mvmtitm.equals(Itm)) {
                DBA.openDBCon();
                DBA.GetMovementData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }

    @Action
    public void NextRecord() {
        if(jComboBoxMovement.getSelectedIndex() <= (jComboBoxMovement.getItemCount()-2)){
            jComboBoxMovement.setSelectedIndex(jComboBoxMovement.getSelectedIndex()+1);
        }

        String Itm = jComboBoxMovement.getSelectedItem().toString();

        for(String s[] : Movement){
            String mvmtitm = s[0] + " - " + s[2] + " - " + s[1];
            if (mvmtitm.equals(Itm)) {
                DBA.openDBCon();
                DBA.GetMovementData(s[0]);
                DBA.closeDBCon();
            }
        }

        SetData();
    }

    @Action
    public void ExitMovement() {
        dispose();
    }

    @Action
    public void RefreshSet() {
        //Refresh data set.
        if((!jTextFieldBrewID.equals("")) && (jCheckBoxSameBrew.isSelected())){
            jComboBoxMovement.removeAllItems();

            DBA.openDBCon();
            String bidee = jTextFieldBrewID.getText();
            Movement = DBA.RunSQLQuery("SELECT MovementID,MovementBrewID,MovementDate FROM Movement" +
                    " WHERE MovementBrewID = '" + bidee + "'");
            DBA.closeDBCon();

            for(String s[] : Movement){
                String mvmtitm = s[0] + " - " + s[2] + " - " + s[1];
                jComboBoxMovement.addItem(mvmtitm);
            }

            FirstRecord();
        } else {
            jComboBoxMovement.removeAllItems();

            DBA.openDBCon();
            Movement = DBA.RunSQLQuery("SELECT MovementID,MovementBrewID,MovementDate FROM Movement");
            DBA.closeDBCon();

            for(String s[] : Movement){
                String mvmtitm = s[0] + " - " + s[2] + " - " + s[1];
                jComboBoxMovement.addItem(mvmtitm);
            }

            FirstRecord();

            jTextFieldBrewID.setText("");
        }
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonExit;
    private javax.swing.JButton jButtonFirst;
    private javax.swing.JButton jButtonLast;
    private javax.swing.JButton jButtonNext;
    private javax.swing.JButton jButtonPrev;
    private javax.swing.JButton jButtonRefresh;
    private javax.swing.JCheckBox jCheckBoxSameBrew;
    private javax.swing.JComboBox jComboBoxMovement;
    private javax.swing.JLabel jLabeMovementID;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelMovementBrewID;
    private javax.swing.JLabel jLabelMovementDate;
    private javax.swing.JLabel jLabelMovementEmpID;
    private javax.swing.JLabel jLabelMovementNVID;
    private javax.swing.JLabel jLabelMovementNotes;
    private javax.swing.JLabel jLabelMovementOVID;
    private javax.swing.JLabel jLabelMovementOldState;
    private javax.swing.JLabel jLabelMovementStateID;
    private javax.swing.JLabel jLabelMovementVolume;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTextField jTextFieldBrewID;
    // End of variables declaration//GEN-END:variables

}
